/**
 * 
 */
package org.jenkon.commons.io.filter;

import java.io.File;
import java.io.FileFilter;
import java.util.List;

/**
 * implementing {@link FileFilter} class for and compare many {@link FileFilter} .
 * 
 * @author Jens Konopka
 * 
 */
public class AndFileFilter extends AbstractConditionFileFilter {

	/**
	 * 
	 */
	private static final long serialVersionUID = -5555006253351927034L;

	/**
	 * 
	 */
	public AndFileFilter() {
		super();
	}

	/**
	 * @param filters {@link List} with delegating {@link FileFilter}
	 */
	public AndFileFilter(final List<FileFilter> filters) {
		super(filters);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.io.FileFilter#accept(java.io.File)
	 */
	public boolean accept(final File pathname) {
		for (final FileFilter filter : getFilters()) {
			if (!filter.accept(pathname)) {
				return false;
			}
		}
		return true;
	}

}
